package com.ruoyi.web.controller.system;

import com.ruoyi.system.domain.User;
import com.ruoyi.system.mapper.UserMapper;
import com.ruoyi.system.service.UserSerice;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
public class HelloController {
    @Autowired
    private UserSerice userSerice;

    @GetMapping("/hello")
    public String hello(){
        return "helloword springboot";
    }
    @GetMapping("/hello1")
    public List<User> hello1(){
        return userSerice.selectAllUser();
    }
    @PostMapping("/hello2")
    public String addUser(User user){
        return  userSerice.addUser(user);
    }
    @PutMapping("/hello3")
    public String putUser(User user){
        return  userSerice.putUser(user);
    }
    @RequestMapping(value = "/hello4", method = RequestMethod.DELETE)
    public String deleteUser(@ModelAttribute("id") int id){
        return userSerice.deleteUser(id);
    }
}
